//
//  AppealViewController.m
//  FengyuanXS
//
//  Created by 王冬 on 2020/7/25.
//  Copyright © 2020 王冬. All rights reserved.
//

#import "AppealViewController.h"
#import <WebKit/WebKit.h>
#import "PublishViewController.h"
@interface AppealViewController ()
@property (weak, nonatomic) IBOutlet UIView *backView;
@property (weak, nonatomic) IBOutlet UIButton *phoneBtn;
@property (nonatomic, strong)WKWebView *webView;
@end

@implementation AppealViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"提请诉求";
    [self.phoneBtn setTitle:[TokenManager getHotTel] forState:UIControlStateNormal];
    self.view.backgroundColor = [UIColor whiteColor];
    self.webView = [[WKWebView alloc] init];
       self.webView.scrollView.bounces = false;//禁止滑动
       [self.webView.scrollView setShowsVerticalScrollIndicator:NO];

       [self.webView.scrollView setShowsHorizontalScrollIndicator:NO];

       [self.backView addSubview:self.webView];
  
       UIEdgeInsets padding = UIEdgeInsetsMake(10, 10, 10, 10);
       [self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
           make.edges.equalTo(self.backView).with.insets(padding);
       }];
}
-(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBar.hidden = NO;
    [super viewWillAppear:animated];
    [self getdata];
}

-(void)getdata{
    [[ToastManager shardInstance]showSystemProgress:self.view];
    [[ApiManager ShardInstance]getDetailNoticeID:@"28" resultBlock:^(NSDictionary *data, NSError *error) {
        BaseModel *model = [BaseModel mj_objectWithKeyValues:data];
        if (model.code == 1) {
            [[ToastManager shardInstance]hideProgress:self.view];
            
            [self.webView loadHTMLString:[NSString stringWithFormat:@"%@",data[@"rs"][@"content"]] baseURL:nil];
        }
        
    }];
}

- (IBAction)phoneBtn:(UIButton *)sender {
    NSMutableString *str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",[TokenManager getHotTel]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
   
}
- (IBAction)commitBtn:(BoardButton *)sender {
    
    PublishViewController *pubVC = [PublishViewController loadStroyboard:[PublishViewController new]];
       pubVC.hidesBottomBarWhenPushed = YES;
       [self.navigationController pushViewController:pubVC animated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
